#include "exit.h"
#include "stm32f4xx.h"
#include "led.h"
void delay(unsigned int t)
{
	while(t--);
}

void exit_init()
{
	EXTI_InitTypeDef EXIT_InitStruct;
	
	EXIT_InitStruct.EXTI_Line = EXTI_Line5;
	EXIT_InitStruct.EXTI_LineCmd = ENABLE;
	EXIT_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
	EXIT_InitStruct.EXTI_Trigger = EXTI_Trigger_Falling;
	
	
	EXTI_Init(&EXIT_InitStruct);
}

void EXTI9_5_IRQHandler(void)
{
	if((EXTI_GetITStatus(EXTI_Line5) == SET))
	{
		delay(0x8fffff);
		delay(0xB);
		if((GPIO_ReadInputDataBit(GPIOI, GPIO_Pin_5) == Bit_RESET) )
			GPIO_ToggleBits(GPIOH,GPIO_Pin_5);
		EXTI_ClearITPendingBit(EXTI_Line5);
	}
	

}	



